# coding=UTF-8
import json
import re

import requests

session = requests.Session()
session.headers['token'] = 'd44ac399472d48f79bb637e9c72a6c29'
url = "http://www.testingedu.com.cn:8081/inter/SOAP?wsdl"
param = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.testingedu.com/"><soapenv:Header/><soapenv:Body><soap:login><arg0>Will</arg0><arg1>123456</arg1></soap:login></soapenv:Body></soapenv:Envelope>'
response = session.post(url=url, data=param)
text = response.text
result = re.findall("return>(.+?)</return>", text)
print(text)
print(result[0])
ll = result[0]
a = json.loads(ll)
print(a)


# from Keywords.inter_keys import Inter
# inter = Inter()
# inter.post_soap('http://www.testingedu.com.cn:8081/inter/SOAP?wsdl',
#                 '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.testingedu.com/"><soapenv:Header/><soapenv:Body><soap:login><arg0>Will</arg0><arg1>123456</arg1></soap:login></soapenv:Body></soapenv:Envelope>')
# inter.assertequalsRe("return>(.+?)</return>", '{"status":405,"msg":"非法请求"}')

